home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / netzwerk / parnet / sources / unit_ctl.c < prev    next >
C/C++ Source or Header  |  1996-02-26  |  1KB  |  87 lines

  1.  
  2. /*
  3.  *  UNIT_CTL.C
  4.  *
  5.  *  Control Unit.  Used for global control, sink null as far as
  6.  *           read & write goes.
  7.  */
  8.  
  9. #include "defs.h"
  10.  
  11. void CtlAbortIO(Iob *);
  12. void CtlClose(Iob *);
  13. void CtlData(int, Unit *, Packet *);
  14. void UnitControlOpen(Iob *, long, long);
  15.  
  16.  
  17. static short   CtlRefs = 0;
  18.  
  19. void
  20. UnitControlOpen(iob, unitnum, flags)
  21. Iob *iob;
  22. long unitnum;
  23. long flags;
  24. {
  25.     Unit *unit = AllocUnit(iob, CtlBeginIO, CtlAbortIO, CtlData, CtlClose);
  26.  
  27.     ++CtlRefs;
  28.  
  29.     iob->io_Unit = unit;
  30.     iob->io_Port = 0;
  31.     iob->io_Addr = 0;
  32. }
  33.  
  34. void
  35. CtlData(cmd, unit, packet)
  36. int cmd;
  37. Unit *unit;
  38. Packet *packet;
  39. {
  40.     FreeParPacket(packet);
  41. }
  42.  
  43.  
  44. void
  45. CtlClose(iob)
  46. Iob *iob;
  47. {
  48.     FreeUnit(iob->io_Unit);
  49.  
  50.     --CtlRefs;
  51.  
  52.     iob->io_Unit = NULL;
  53. }
  54.  
  55. void
  56. CtlBeginIO(iob)
  57. Iob *iob;
  58. {
  59.     iob->io_Error = 0;
  60.     iob->io_Actual = 0;
  61.     iob->io_Message.mn_Node.ln_Type = NT_MESSAGE;
  62.  
  63.     switch(iob->io_Command) {
  64.     case PPD_SETADDR:    /*  set network address     */
  65.     ParAddress(iob->io_Addr);
  66.     DevBase->ParAddress = iob->io_Addr;
  67.     WriteConfig();
  68.     break;
  69.     case PPD_SETTO:    /*  set network timeout     */
  70.     ParLLTimeout = iob->io_Offset;
  71.     WriteConfig();
  72.     break;
  73.     default:
  74.     iob->io_Error = IOERR_NOCMD;
  75.     break;
  76.     }
  77.     if ((iob->io_Flags & IOF_QUICK) == 0)
  78.     ReplyMsg(&iob->io_Message);
  79. }
  80.  
  81. void
  82. CtlAbortIO(iob)
  83. Iob *iob;
  84. {
  85. }
  86.  
  87.